<div class="page" style="min-height: 500px;">
  <div class="page-container">
    <div class="container">
      <div class="row">
        <div class="span12">
          <div class="btn-group pull-right">
            <a href="<?php echo base_url('profile/' . $user_data['user_name']); ?>" class="btn">Profile</a>
            <a href="<?php echo base_url('wall/' . $user_data['user_name']); ?>" class="btn">Wall</a>
            <?php if (($this->current_user['user_name'] == $user_data['user_name']) || ($this->is_admin)) { ?>
              <a href="<?php echo base_url('activity/' . $user_data['user_name']); ?>" class="btn active">Activity</a>
            <?php } ?>
            <?php if (($this->is_admin) && (!check_is_admin($user_data['user_name']))) { ?>
              <a onclick="return confirm_action('Disable this user ?');" title="Disable this user. Incase of Resign etc.." href="<?php echo base_url('users/disable/' . $user_data['user_name']); ?>" class="btn">Disable</a>
            <?php } ?>
          </div>
          <h4 class="header">Recent Activity : <?php echo $user_data['user_display_name']; ?></h4>
        </div>
        <div class="span12">
          <?php if (!empty($activity_data)) { ?>
            <table id="users_table" class="table table-striped sortable">
              <thead>
                <tr>
                  <th width="15%">Date</th>
                  <th width="85%">Activity</th>
                </tr>
              </thead>
              <tbody>
                <?php foreach ($activity_data as $activity) { ?>
				<?php $activity['activity_message'] = strip_tags($activity['activity_message']); ?>
                  <tr>
                    <?php if ($activity['activity_type'] == 1) { ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Added a new tweet - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('tweet', $activity['activity_id'])); ?>"><?php echo mb_substr($activity['activity_message'], 0, 50) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 2) { ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Replied to a tweet - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('reply', $activity['activity_id'])); ?>"><?php echo mb_substr(strip_tags($activity['activity_message'], '<img>'), 0, 50) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 3) { ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Added a new event - <a style="text-decoration: none;" href="<?php echo base_url('events'); ?>"><?php echo mb_substr($activity['activity_message'], 0, 100) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 4) { ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Added a new album - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('album', $activity['activity_id'])); ?>"><?php echo mb_substr($activity['activity_message'], 0, 50) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 5) { ?>
                      <?php if ($activity['activity_message'] == 'tweet') { ?>
                        <?php $get_like_type_data = get_like_type_data('tweet', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes a tweet - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('tweet', $activity['activity_id'])); ?>"><?php echo mb_substr($get_like_type_data['tweet_subject'], 0, 50) . '...'; ?></a></td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'reply') { ?>
                        <?php $get_like_type_data = get_like_type_data('reply', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes a reply - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('reply', $activity['activity_id'])); ?>"><?php echo mb_substr(strip_tags($get_like_type_data['tweet_reply_message'], '<img>'), 0, 50) . '...'; ?></a></td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'album') { ?>
                        <?php $get_like_type_data = get_like_type_data('album', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes an album - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('album', $activity['activity_id'])); ?>"><?php echo mb_substr($get_like_type_data['album_name'], 0, 50) . '...'; ?></a></td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'photo') { ?>
                        <?php $get_like_type_data = get_like_type_data('photo', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes a photo - 
                            <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('photo', $activity['activity_id'])); ?>">
                              <img style="vertical-align: top; max-height: 20px;" src="<?php echo base_url('assets/albums/') . '/' . $get_like_type_data['photo_album_id'] . '/' . mb_substr($get_like_type_data['photo_file'], 0, 32) . '_thumb.jpg'; ?>"/>
                            </a>
                          </td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'video') { ?>
                        <?php $get_like_type_data = get_like_type_data('photo', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes a video - 
                            <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('video', $activity['activity_id'])); ?>">
                              <img style="vertical-align: top; max-height: 20px;" src="<?php echo base_url('assets/albums/') . '/' . $get_like_type_data['photo_album_id'] . '/' . mb_substr($get_like_type_data['photo_file'], 0, 32) . '_thumb.jpg'; ?>"/>
                            </a>
                          </td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'wall_post') { ?>
                        <?php $get_like_type_data = get_like_type_data('wall_post', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes a wall post - <a style="text-decoration: none;" href="<?php echo base_url('wall/' . $get_like_type_data['user_name']); ?>"><?php echo mb_substr(preg_replace('/(<br>)+$/', '', $get_like_type_data['wall_post_message']), 0, 50) . '...'; ?></a></td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'poll') { ?>
                        <?php $get_like_type_data = get_like_type_data('poll', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Likes a poll - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('poll', $activity['activity_id'])); ?>"><?php echo mb_substr(preg_replace('/(<br>)+$/', '', $get_like_type_data['poll_message']), 0, 50) . '...'; ?></a></td>
                        <?php } ?>
                      <?php } ?>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 6) { ?>
                      <?php $get_like_type_data = get_like_type_data('wall_post', $activity['activity_id']); ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Added a new wall post - <a style="text-decoration: none;" href="<?php echo base_url('wall/' . $get_like_type_data['user_name']); ?>"><?php echo mb_substr($activity['activity_message'], 0, 50) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 7) { ?>
                      <?php $get_like_type_data = get_like_type_data('poll', $activity['activity_id']); ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Added a new poll - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('poll', $activity['activity_id'])); ?>"><?php echo mb_substr($activity['activity_message'], 0, 50) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 8) { ?>
                      <?php $get_like_type_data = get_like_type_data('poll', $activity['activity_id']); ?>
                      <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                      <td>Replied to a poll - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('poll', $activity['activity_id'])); ?>"><?php echo mb_substr($activity['activity_message'], 0, 50) . '...'; ?></a></td>
                    <?php } ?>
                    <?php if ($activity['activity_type'] == 9) { ?>
                      <?php if ($activity['activity_message'] == 'poll') { ?>
                        <?php $get_like_type_data = get_like_type_data('poll', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Commented a poll - <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('poll', $activity['activity_id'])); ?>"><?php echo mb_substr(preg_replace('/(<br>)+$/', '', $get_like_type_data['poll_message']), 0, 50) . '...'; ?></a></td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'photo') { ?>
                        <?php $get_like_type_data = get_like_type_data('photo', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Commented on a photo - 
                            <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('photo', $activity['activity_id'])); ?>">
                              <img style="vertical-align: top; max-height: 20px;" src="<?php echo base_url('assets/albums/') . '/' . $get_like_type_data['photo_album_id'] . '/' . mb_substr($get_like_type_data['photo_file'], 0, 32) . '_thumb.jpg'; ?>"/>
                            </a>
                          </td>
                        <?php } ?>
                      <?php } ?>
                      <?php if ($activity['activity_message'] == 'video') { ?>
                        <?php $get_like_type_data = get_like_type_data('photo', $activity['activity_id']); ?>
                        <?php if ($get_like_type_data) { ?>
                          <td><?php echo date('d-M-Y H:i:s', strtotime($activity['activity_date'])); ?></td>
                          <td>Commented on a video - 
                            <a style="text-decoration: none;" href="<?php echo base_url('redirect?post_id=' . make_post_id('video', $activity['activity_id'])); ?>">
                              <img style="vertical-align: top; max-height: 20px;" src="<?php echo base_url('assets/albums/') . '/' . $get_like_type_data['photo_album_id'] . '/' . mb_substr($get_like_type_data['photo_file'], 0, 32) . '_thumb.jpg'; ?>"/>
                            </a>
                          </td>
                        <?php } ?>
                      <?php } ?>
                    <?php } ?>
                  </tr>
                <?php } ?>
              </tbody>
            </table>
          <?php } else { ?>
            No activities !
          <?php } ?>
        </div>
      </div>
    </div>
  </div>
</div>